Plugin Directory: Emit a PHP warning when a ZIP fails to build - #765
Plugin Directory: Emit a PHP warning when a ZIP fails to build#765obenland wants to merge 5 commits into
Conversation
Previously a failed ZIP build was silently swallowed in two places: the per-version catch in Zip\Builder::build() skips the version, and Import::rebuild_affected_zips() catches the Builder exception and returns false. In both cases the import reports success and nothing reaches the error log, so build outages go unnoticed. Trigger an E_USER_WARNING with the slug, version(s), and underlying error in both spots, and record the failure in the import warnings so it also lands in the _import_warnings post meta and the wporg_plugins_imported action. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Pull request overview
Adds explicit logging for Plugin Directory ZIP build failures that were previously silent, improving observability during automated imports and ZIP generation.
Changes:
- Emit
E_USER_WARNINGwhen an individual version ZIP build fails insideZip\Builder::build(). - Emit
E_USER_WARNING(and record an import warning) whenCLI\Import::rebuild_affected_zips()catches a ZIP builder exception.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| wordpress.org/public_html/wp-content/plugins/plugin-directory/zip/class-builder.php | Logs per-version ZIP build failures instead of silently skipping them. |
| wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php | Logs import-level ZIP rebuild failures and records them in the import warnings array. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Exception messages from the ZIP builder can embed raw SVN/command output containing newlines and tabs, producing multi-line error_log entries. Collapse that whitespace before passing the message to trigger_error(). Also store the affected versions alongside the normalized message in the zip_build_failed import warning, so _import_warnings post meta and the wporg_plugins_imported action record which versions failed to build. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
$checksum_file and $signature_file are only assigned when their generation steps actually run, so in a multi-version build they could retain the previous version's paths. A version that failed early, or skipped checksum generation (trunk, missing headers), would then SVN::up()/SVN::add() the prior version's checksum file in the error-recovery and commit paths. Clearing both properties per iteration confines error handling to the current version's files. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (1)
wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php:665
- $versions_to_build can have non-sequential numeric keys (due to unset() earlier when release confirmations are enabled). array_unique() preserves keys, so $failed_versions may end up with non-0-based keys and will JSON-encode as an object (e.g. {"2":"1.2"}) instead of a list. Normalize the keys with array_values() before storing in $this->warnings and logging.
$failed_versions = array_unique( $versions_to_build );
$error = preg_replace( '/[\r\n\t]+/', ' ', $e->getMessage() );
What
Emits an
E_USER_WARNINGviatrigger_error()when a plugin ZIP fails to build, at the two places where failures are currently swallowed silently:Zip\Builder::build()— the per-versioncatchskips the failed version and moves on with no output.CLI\Import::rebuild_affected_zips()— catches the Builder exception andreturn false, so the import still reportsOKwith nothing in the error log.The import-level failure is also recorded in
$this->warnings['zip_build_failed'], so it propagates to the_import_warningspost meta and thewporg_plugins_importedaction.Why
On August 5, 2026, ZIP builds failed for every plugin release between r3635509 (9:54:44 CDT) and r3635601 (11:19:54 CDT) — 42 plugins released a new version whose download URL 404s, while the imports themselves appeared to succeed. Because both failure paths are silent, nothing surfaced in logs or monitoring. With this change, each failed build logs a PHP warning identifying the plugin, version(s), and underlying error.
The message format follows the existing
trigger_error()precedent inJobs\Plugin_Scan_GandalfandShortcodes\Upload_Handler.🤖 Generated with Claude Code